package com.py.androidUtils.UI;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.py.androidUtils.base.BaseFragment;
import com.py.androidUtils.utils.LoadingImages;
import com.readyidu.app.R;

public class ImagesFragment extends BaseFragment {
	private ImageView imageView;
	private String imagesPath = "";
	private ProgressBar loadImags;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.imagesPath = getArguments().getString("path");
	}

	public static ImagesFragment newInstance(String imagesPath) {
		ImagesFragment fragment = new ImagesFragment();
		Bundle args = new Bundle();
		args.putString("path", imagesPath);
		fragment.setArguments(args);
		return fragment;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		LoadingImages.getInstance().loadingImages(imagesPath, imageView, loadImags);
		// LoadingImages.getInstance().loadingImages(imagesPath, imageView, 0);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.fragment_images, container, false);
		imageView = (ImageView) view.findViewById(R.id.images);
		loadImags = (ProgressBar) view.findViewById(R.id.loadImags);
		return view;
	}
}
